#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//

ll w,h,x;
void solve()
{
	vector<ll> v1,v2,v3,v4;
	
	cin>>w>>h;
	
	int n1;
	cin>>n1;
	for(int i=1;i<=n1;i++) 
	{
		cin>>x;
		v1.push_back(x);
	}
	int n2;
	cin>>n2;
	for(int i=1;i<=n2;i++) 
	{
		cin>>x;
		v2.push_back(x);
	}
	int n3;
	cin>>n3;
	for(int i=1;i<=n3;i++)
	{
		cin>>x;
		v3.push_back(x);
	}
	int n4;
	cin>>n4;
	for(int i=1;i<=n4;i++)
	{
		cin>>x;
		v4.push_back(x);
	}
	sort(all(v1));
	sort(all(v2));
	sort(all(v3));
	sort(all(v4));
	
	ll ans1=max(v1[n1-1]-v1[0], v2[n2-1]-v2[0])*h;
	ll ans2=max(v3[n3-1]-v3[0],v4[n4-1]-v4[0])*w;
	cout<<max(ans1,ans2)<<'\n';
	
	
	


}

int main()
{
	close();
	int T; cin>>T;
	while (T--) solve();
	return 0;
}
